package com.hjm.project.statistical.snAllot.controller;

import java.util.List;

import com.hjm.project.statistical.snAllot.domain.SnAllot;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hjm.framework.aspectj.lang.annotation.Log;
import com.hjm.framework.aspectj.lang.enums.BusinessType;
import com.hjm.project.statistical.snAllot.service.ISnAllotService;
import com.hjm.framework.web.controller.BaseController;
import com.hjm.framework.web.domain.AjaxResult;
import com.hjm.common.utils.poi.ExcelUtil;
import javax.annotation.Resource;
import com.hjm.framework.web.page.TableDataInfo;

/**
 * 终端分配统计Controller
 * 
 * @author maker-platform
 * @date 2022-01-17
 */
@Controller
@RequestMapping("/statistical/snAllot")
public class SnAllotController extends BaseController {
    private String prefix = "statistical/snAllot";

    @Resource
    private ISnAllotService snAllotService;

    @RequiresPermissions("statistical:snAllot:view")
    @GetMapping()
    public String snAllot() {
        return prefix + "/snAllot";
    }

    /**
     * 查询终端分配统计列表
     */
    @RequiresPermissions("statistical:snAllot:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SnAllot snAllot) {
        startPage();
        List<SnAllot> list = snAllotService.selectSnAllotList(snAllot);
        return getDataTable(list);
    }

    /**
     * 导出终端分配统计列表
     */
    @RequiresPermissions("statistical:snAllot:export")
    @Log(title = "终端分配统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(SnAllot snAllot) {
        List<SnAllot> list = snAllotService.selectSnAllotList(snAllot);
        ExcelUtil<SnAllot> util = new ExcelUtil<SnAllot>(SnAllot.class);
        return util.exportExcel(list, "snAllot");
    }


}
